home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
C++
/
Applications
/
PICSee Dust 1.01
/
Preferences source
/
PICS_MarqueePane.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1995-11-16
|
4KB
|
143 lines
#include "PICS_PreferencesPanes.h"
#include <ColorPicker.h>
enum {
// Marquee color pane
kMarqueePane_HiliteColorRadio = kPrefsDlog_LastItem,
kMarqueePane_BlackColorRadio,
kMarqueePane_CustomColorRadio,
kMarqueePane_HiliteColorBox,
kMarqueePane_BlackColorBox,
kMarqueePane_CustomColorBox,
kMarqueePane_LineSeparator,
kMarqueePane_Box
};
// ---------------------------------------------------------------------------
void PrefsDialogSetupMarqueePane(DialogPtr prefsDlog) {
switch((**sPrefsData->prefs).marqueeColor) {
case kMarqueeUseHiliteColor:
SelectRadioBtn(prefsDlog, kMarqueePane_HiliteColorRadio,
kMarqueePane_HiliteColorRadio,
kMarqueePane_CustomColorRadio);
break;
case kMarqueeUseBlackColor:
SelectRadioBtn(prefsDlog, kMarqueePane_BlackColorRadio,
kMarqueePane_HiliteColorRadio,
kMarqueePane_CustomColorRadio);
break;
case kMarqueeUseCustomColor:
SelectRadioBtn(prefsDlog, kMarqueePane_CustomColorRadio,
kMarqueePane_HiliteColorRadio,
kMarqueePane_CustomColorRadio);
break;
}
Rect customColorBox;
GetDItemRect(prefsDlog, kMarqueePane_CustomColorBox, &customColorBox);
InvalRect(&customColorBox);
} // END PrefsDialogSetupMarqueePane
// ---------------------------------------------------------------------------
Boolean PrefsDialogGetMarqueePaneSettings(DialogPtr prefsDlog) {
short itemHit;
itemHit = GetRadioBtn(prefsDlog, kMarqueePane_HiliteColorRadio,
kMarqueePane_CustomColorRadio) - kMarqueePane_HiliteColorRadio;
(**sPrefsData->prefs).marqueeColor = itemHit;
return(true);
} // END PrefsDialogSetupMarqueePane
// ---------------------------------------------------------------------------
void PrefsDialogMarqueePaneHit(DialogPtr prefsDlog, short itemHit) {
switch(itemHit) {
case kMarqueePane_HiliteColorRadio:
case kMarqueePane_BlackColorRadio:
case kMarqueePane_CustomColorRadio:
SelectRadioBtn(prefsDlog, itemHit,
kMarqueePane_HiliteColorRadio, kMarqueePane_CustomColorRadio);
break;
case kMarqueePane_CustomColorBox:
Point where = { -1, -1 };
RGBColor theColor = (**sPrefsData->prefs).customRGBColor;
if (GetColor(where, "\pPick a marquee color",
&theColor, &theColor)) {
(**sPrefsData->prefs).customRGBColor = theColor;
SelectRadioBtn(prefsDlog,
kMarqueePane_CustomColorRadio,
kMarqueePane_HiliteColorRadio,
kMarqueePane_CustomColorRadio);
}
break;
}
} // END PrefsDialogSetupMarqueePane
// ---------------------------------------------------------------------------
void PrefsDialogMarqueePaneUpdate(
DialogPtr prefsDlog,
EventRecord *theEvt,
Boolean frontMost) {
Rect lineRect;
GetDItemRect(prefsDlog, kMarqueePane_Box, &lineRect);
GrayDrawShadowBox(&lineRect, NULL);
GetDItemRect(prefsDlog, kMarqueePane_LineSeparator, &lineRect);
GrayDrawShadowLine(&lineRect, NULL);
Rect colorBox;
RGBColor fillColor;
RGBColor saveFore;
GetForeColor(&saveFore);
// Draw hilite color box
GetDItemRect(prefsDlog, kMarqueePane_HiliteColorBox, &colorBox);
LMGetHiliteRGB(&fillColor);
RGBForeColor(&fillColor);
PaintRect(&colorBox);
// Draw black color box
GetDItemRect(prefsDlog, kMarqueePane_BlackColorBox, &colorBox);
fillColor.red = fillColor.green = fillColor.blue = 0;
RGBForeColor(&fillColor);
PaintRect(&colorBox);
// Draw custom color box
GetDItemRect(prefsDlog, kMarqueePane_CustomColorBox, &colorBox);
fillColor = (**sPrefsData->prefs).customRGBColor;
RGBForeColor(&fillColor);
PaintRect(&colorBox);
RGBForeColor(&saveFore);
for (short i = kMarqueePane_HiliteColorBox;
i <= kMarqueePane_CustomColorBox; i++) {
GetDItemRect(prefsDlog, i, &colorBox);
FrameRect(&colorBox);
}
} // END PrefsDialogMarqueePaneUpdate
// ---------------------------------------------------------------------------
void PrefsDialogMarqueePaneActivate(DialogPtr prefsDlog, Boolean activate) {
short hiliteMode = activate ? 0 : 255;
for (short i = kMarqueePane_HiliteColorRadio;
i <= kMarqueePane_CustomColorRadio; i++) {
HiliteControl((ControlHandle)GetDItemHdl(prefsDlog, i), hiliteMode);
}
} // END PrefsDialogMarqueePaneActivate